package br.ufrj.dcc.manifestacoes.model;

import java.util.Date;

import com.mongodb.DBObject;

import br.ufrj.dcc.manifestacoes.business.FacebookBusiness;
import br.ufrj.dcc.manifestacoes.util.FacebookUtil;

import facebook4j.Comment;
import facebook4j.User;

public class Comentario {
	
	public static final String FIELD_ID = "id";
	public static final String FIELD_MESSAGE = "message";
	public static final String FIELD_TIME = "createdTime";
	public static final String FIELD_LIKES = "likes";
	public static final String FIELD_ID_USUARIO = "idUsuario";
	public static final String FIELD_NOME_USUARIO = "nomeUsuario";
	public static final String FIELD_GENERO = "genero";
	
	private String id;
	private String message;
	private Date createdTime;
	private Integer likes;
	private String idUsuario;
	private String nomeUsuario;
	private Integer genero;
	
	public Comentario(Comment comment){
		id = comment.getId();
		message = comment.getMessage();
		createdTime = comment.getCreatedTime();
		likes = comment.getLikeCount();
		idUsuario = comment.getFrom().getId();
		nomeUsuario = comment.getFrom().getName();
	}
	
	public Comentario(Comment comment, String genero) {
		id = comment.getId();
		message = comment.getMessage();
		//createdTime = comment.getCreatedTime();
		likes = comment.getLikeCount();
		idUsuario = comment.getFrom().getId();
		this.setGenero(FacebookUtil.generoToInt(genero));
		nomeUsuario = comment.getFrom().getName();
	}

	public Comentario(DBObject object) {
		this.id = (String) object.get(FIELD_ID);
		//this.createdTime = FacebookBusiness.parseTimestamp(object.get(FIELD_TIME).toString());
		this.message = (String) object.get(FIELD_MESSAGE);
		this.idUsuario = (String) object.get(FIELD_ID_USUARIO);
		this.nomeUsuario = (String) object.get(FIELD_NOME_USUARIO);
		this.setGenero((Integer) object.get(FIELD_GENERO));
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	public Integer getLikes() {
		return likes;
	}
	public void setLikes(Integer likes) {
		this.likes = likes;
	}
	public String getIdUsuario() {
		return idUsuario;
	}
	public void setIdUsuario(String idUsuario) {
		this.idUsuario = idUsuario;
	}


	public String getNomeUsuario() {
		return nomeUsuario;
	}


	public void setNomeUsuario(String nomeUsuario) {
		this.nomeUsuario = nomeUsuario;
	}

	public Integer getGenero() {
		return genero;
	}

	public void setGenero(Integer genero) {
		this.genero = genero;
	}
	
	
	
	
}
